package so.wy.servicecenter.businessbed.service.order.dto;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
import so.wy.servicecenter.businessbed.dao.rdb.order.order.OrderDO;

import java.math.BigDecimal;
import java.util.Date;

/**
* @author wdl
* @date 2020-04-08
*/
@Data
@NoArgsConstructor
public class OrderDTO{

	/** 订单ID */
	private Long orderId;
	/** 订单编号 */
	private String orderSerial;
	/** 开单时间 */
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date orderTime;
	/** 结单时间 */
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date orderEndTime;
	/** 使用时长 */
	private Integer useLength;
	/** 订单金额 */
	private BigDecimal orderAmount;
	/** 订单支付金额 */
	private BigDecimal orderAmountPay;
	/** 设备编号 */
	private String deviceSerial;
	/** 租户ID */
	private Long rentUserId;
	/** 医院ID */
	private Long hospitalId;
	/** 楼栋ID */
	private Long buildingId;
	/** 楼层ID */
	private Long floorId;
	/** 科室ID */
	private Long departId;
	/** 订单状态 */
	private Integer orderStatus;
	/** 支付状态 */
	private Integer payStatus;
	/** 订单备注 */
	private String orderRemark;
	/** 价格描述 */
	private String priceDesc;
	/** 租户名 */
	private String rentUserName;
	/** 用户手机号 */
	private String userPhone;
	/** 医院名称 */
	private String hospitalName;
	/** 楼栋名称 */
	private String buildingName;
	/** 楼层名称 */
	private String floorName;
	/** 科室名称 */
	private String departName;
	/** 排序 */
	private Integer sortNum;

	private Date startTime;
	private Date endTime;

	public OrderDTO(OrderDO orderDO){
		if(orderDO==null){
			return ;
		}

		this.orderId = orderDO.getOrderId();
		this.orderSerial = orderDO.getOrderSerial();
		this.orderTime = orderDO.getOrderTime();
		this.orderEndTime = orderDO.getOrderEndTime();
		this.useLength = orderDO.getUseLength();
		this.orderAmount = orderDO.getOrderAmount();
		this.orderAmountPay = orderDO.getOrderAmountPay();
		this.deviceSerial = orderDO.getDeviceSerial();
		this.rentUserId = orderDO.getRentUserId();
		this.hospitalId = orderDO.getHospitalId();
		this.buildingId = orderDO.getBuildingId();
		this.floorId = orderDO.getFloorId();
		this.departId = orderDO.getDepartId();
		this.orderStatus = orderDO.getOrderStatus();
		this.payStatus = orderDO.getPayStatus();
		this.orderRemark = orderDO.getOrderRemark();
		this.priceDesc = orderDO.getPriceDesc();
		this.rentUserName = orderDO.getRentUserName();
		this.userPhone = orderDO.getUserPhone();
		this.hospitalName = orderDO.getHospitalName();
		this.buildingName = orderDO.getBuildingName();
		this.floorName = orderDO.getFloorName();
		this.departName = orderDO.getDepartName();
		this.sortNum = orderDO.getSortNum();
	}

	public OrderDO convert2DO(){
		OrderDO orderDO = new OrderDO();
		orderDO.setOrderId(this.orderId);
		orderDO.setOrderSerial(this.orderSerial);
		orderDO.setOrderTime(this.orderTime);
		orderDO.setOrderEndTime(this.orderEndTime);
		orderDO.setUseLength(this.useLength);
		orderDO.setOrderAmount(this.orderAmount);
		orderDO.setOrderAmountPay(this.orderAmountPay);
		orderDO.setDeviceSerial(this.deviceSerial);
		orderDO.setRentUserId(this.rentUserId);
		orderDO.setHospitalId(this.hospitalId);
		orderDO.setBuildingId(this.buildingId);
		orderDO.setFloorId(this.floorId);
		orderDO.setDepartId(this.departId);
		orderDO.setOrderStatus(this.orderStatus);
		orderDO.setPayStatus(this.payStatus);
		orderDO.setOrderRemark(this.orderRemark);
		orderDO.setPriceDesc(this.priceDesc);
		orderDO.setRentUserName(this.rentUserName);
		orderDO.setUserPhone(this.userPhone);
		orderDO.setHospitalName(this.hospitalName);
		orderDO.setBuildingName(this.buildingName);
		orderDO.setFloorName(this.floorName);
		orderDO.setDepartName(this.departName);
		orderDO.setSortNum(this.sortNum);
		return orderDO;
	}

}
